




C++ Data Types
A data type specifies the type of data that a variable can store such as integer, floating, character etc.

There are 4 types of data types in C++ language.


Types
Data Types


Basic Data Type
int, char, float, double, etc


Derived Data Type
array, pointer, etc


Enumeration Data Type
enum


User Defined Data Type
structure







Basic Data Types
The basic data types are integer-based and floating-point based. C++ language supports both signed and unsigned literals.
The memory size of basic data types may change according to 32 or 64 bit operating system.
Let's see the basic data types. It size is given according to 32 bit OS.


Data Types
Memory Size
Range


char
1 byte
-128 to 127


signed char
1 byte
-128 to 127


unsigned char
1 byte
0 to 127


short
2 byte
-32,768 to 32,767


signed short
2 byte
-32,768 to 32,767


unsigned short
2 byte
0 to 32,767


int
2 byte
-32,768 to 32,767


signed int
2 byte
-32,768 to 32,767


unsigned int
2 byte
0 to 32,767


short int
2 byte
-32,768 to 32,767


signed short int
2 byte
-32,768 to 32,767


unsigned short int
2 byte
0 to 32,767


long int
4 byte


signed long int
4 byte


unsigned long int
4 byte


float
4 byte


double
8 byte


long double
10 byte














Please Share





